ddns-scripts: fix getting IP address via web in get_current_ip()
authorQian Suyao <[email protected]>
Thu, 10 Jul 2025 15:05:58 +0000 (23:05 +0800)
committerFlorian Eckert <[email protected]>
Tue, 5 Aug 2025 06:37:41 +0000 (08:37 +0200)
Add back the regex searching for valid IP address when getting IP
address via web.

Fixes: 9cdd1a1660b6 ("ddns-scripts: refactor get_current_ip()")
Signed-off-by: Qian Suyao <[email protected]>
net/ddns-scripts/Makefile
net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh

index fd7973540f63f2b219a5dd84ada4d787cabbfd03..4e306b28bb60af5ea8c494afe1105f8f2257358a 100644 (file)
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ddns-scripts
 PKG_VERSION:=2.8.2
-PKG_RELEASE:=76
+PKG_RELEASE:=77
 
 PKG_LICENSE:=GPL-2.0
 
index 9f08e290c7e115b5ef6a74bcb07fc803aab4622f..5afa5547c78778b206388f4df92e64dff26f8944 100644 (file)
@@ -936,7 +936,8 @@ get_current_ip () {
                        [ -z "$ip_url" ] && { write_log 12 "get_current_ip: 'ip_url' not set for source 'web'"; return 2; }
                        do_transfer "$ip_url"
                        # bug: do_transfer does not output to DATFILE
-                       read -r data < "$DATFILE"
+                       [ $use_ipv6 -eq 0 ] && data=$(grep -m 1 -o "$IPV4_REGEX" "$DATFILE")
+                       [ $use_ipv6 -eq 1 ] && data=$(grep -m 1 -o "$IPV6_REGEX" "$DATFILE")
                        [ -n "$data" ] && write_log 7 "Current IP '$data' detected via web at '$ip_url'"
                        ;;
                *)